<template>
    <el-form ref="form" :model="user" label-width="80px">
        <el-form-item label="用户名">
            <el-input v-model="user.name"></el-input>
        </el-form-item>
        <el-form-item label="手机号">
            <el-input v-model="user.phone"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">立即修改</el-button>
            <el-button @click="onExit">取消</el-button>
        </el-form-item>
    </el-form>
</template>

<script>
// import Upload from '@/components/Upload/singleImage3';

export default {
    name: 'userEdit',
    components: {
        // Upload
    },
    props: {
        user: {
            type: Object,
            default: false
        }
    },
    data() {
        return {};
    },
    computed: {},
    methods: {
        onSubmit() {
            this.updateUser();
            this.$emit('submit');
        },
        onExit() {
            this.$emit('close');
        },
        updateUser() {
            this.$ajax.post('/user/admin/update', {
                id: this.user.id,
                name: this.user.name,
                phone: this.user.phone
            });
        }
    }
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
@import 'src/styles/mixin.scss';
</style>

